#include <iostream>
#include <vector>
using namespace std;

bool sb(string s1,string s2){
    vector<int> ans(s2.size()+3,0);
    string s3 = "628";
    for(int i = s2.size() - 1;i >= 0;i--){
        for(int j = 2;j >= 0;j--){
            int x = s2[i] - '0';
            int y = s3[j] - '0';
            int num = x * y;
            if(num >= 10){
                ans[i + j + 1] += num % 10;
                ans[i + j] += num / 10;
            }else{
                ans[i + j + 1] += num;
            }
        }
    }
        for(int i = ans.size() - 1;i >= 0;i--){
            if(ans[i] >= 10){
                ans[i - 1] += ans[i] / 10;
                ans[i] %= 10;
            }
        }
//         for(int i = 0;i < ans.size();i++){
//             cout<<ans[i];
//         }
//         cout<<endl;
        int len2 = ans.size() - 2;
        int len1 = s1.size();
        int j = 0;
        if(ans[0] == 0){
            j = 1;
            len2 -= 1;
        }
    
   //     cout<<len1<<" "<<len2<<endl;
    
        if(len1 > len2) return false;
        if(len1 < len2) return true;
        int i = 0;
        for(;j <= ans.size() - 3;j++,i++){
            if(ans[j] > s1[i] - '0'){
                return true;
            }else if(ans[j] < s1[i] - '0'){
                return false;
            }
        }
    return true;
}
int main(){
    string s1;
    string s2;
    while(cin>>s1>>s2){
        bool res = sb(s1,s2);
        if(res == true){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}
